package com.eduplatform.config;

import com.eduplatform.common.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class ScheduleConfig {

    @Autowired
    private JwtUtils jwtUtils;

    /**
     * 每小时清理一次过期的JWT ID
     */
    @Scheduled(fixedRate = 3600000) // 3600000毫秒 = 1小时
    public void cleanExpiredJwtIds() {
        jwtUtils.cleanExpiredJwtIds();
    }
}